package com.hszl.blog.handler;

import com.hszl.blog.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author: 胡爽
 * @date: 2022/5/20 18:38
 **/
@ControllerAdvice//捕获所有控制器方法产生的异常
public class AllExceptionHandler {

    @ExceptionHandler(Exception.class)
    public Result dpException(Exception e){
        e.printStackTrace();
        return Result.fail(-999,"系统异常");
    }
}
